<?php
namespace app\index\model;

use think\Session;
use app\common\model\Orders as commonOrders;

class Orders extends commonOrders
{
    protected $type = [
        'rent_contact_id'=>'array'
    ];
    /**
     * [getIntergral 获取总旅行币]交换获取总旅行币和总钱数
     * @param  [type] $days [description]
     * @return [type]       [description]
     */
    public function getCost($caravan_id,$sdate,$edate)
    {
        //积分数组
        $intergral_a = model('Calendar')->where('caravan_id', $caravan_id)->where('trusts',0)->where('datetimes', 'between', [$sdate, $edate])->column('single_day_coin');
        //租金数组
        $money_a = model('Calendar')->where('caravan_id', $caravan_id)->where('trusts',1)->where('datetimes', 'between', [$sdate, $edate])->column('single_day_price');
        
        $arr = ['intergral_total'=>array_sum($intergral_a),'money_total'=>array_sum($money_a)];
        return $arr;
    }

    
}
